#ifndef __BUNKER_H__
#define __BUNKER_H__

#include <map>

#include <QFrame>

class QLabel;

/**
 * Represents a bunker which protects the tank
 */
class Bunker : public QFrame
{
  Q_OBJECT

public:
  /**
   * @param squareGif filename of the square tile gif
   * @param neCornerGif filename of the north-east corner tile gif
   * @param seCornerGif filename of the south-east corner tile gif
   * @param swCornerGif filename of the south-west corner tile gif
   * @param nwCornerGif filename of the north-west corner tile gif
   * @param parent parent QWidget of this object
   */
  Bunker (const QString &squareGif,
          const QString &neCornerGif,
          const QString &seCornerGif,
          const QString &swCornerGif,
          const QString &nwCornerGif,
          QWidget *parent = 0);

  /**
   * Attempts to collide a QRect with this Bunker.  If a collision occurs the
   * tile will be damaged and possibly removed.
   *
   * @param rect rectangle of the object to collide with this Bunker
   */
  bool tryHit (const QRect &rect);

  /**
   * Override of the Qt sizeHint method
   */
  virtual QSize sizeHint () const;

public slots:
  /**
   * Resets this Bunker.  This includes setting all tiles to undamaged.
   */
  void reset ();

private:
  std::multimap<int, QLabel *> _tiles;

  QLabel * createTile (const QString &file);
};

#endif
